package hars

import (
	"baby/models"
	"github.com/gin-gonic/gin"
)

func Add(c *gin.Context) {
	name := c.PostForm("name")
	title := c.PostForm("title")
	ban := models.Ban{
		Name:  name,
		Title: title,
	}
	models.DB.Create(&ban)
	c.JSON(200, gin.H{
		"code": 200,
		"msg":  "添加成功",
		"data": ban,
	})
	return
}
func List(c *gin.Context) {
	var ban []models.Ban
	models.DB.Find(&ban)
	c.JSON(200, gin.H{
		"code": 200,
		"msg":  "查询成功",
		"data": ban,
	})
	return
}
